package indi.henry.weatherdemo.repository;

import java.util.List;

import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.CachePut;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.jpa.repository.JpaRepository;

import indi.henry.weatherdemo.entity.CityEntity;

/**
 * The JPA repository for the CityEntity
 * 
 * @author Henry Hu
 */
public interface WeatherRepository extends JpaRepository<CityEntity, String> {
    
    @Cacheable("weather")
    @CachePut("weather")
    @Override
	List<CityEntity> findAll();

    @CachePut("weather")
    @Override
    <S extends CityEntity> S saveAndFlush(S entity);

    @CacheEvict("weather")
    @Override
    void deleteById(String id);
}
